package com.gebogebo.android.distancecalc;

import java.util.ArrayList;
import java.util.List;

import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

/**
 * A map overlay used for distance calculator app
 * 
 * @author viraj
 */
public class DistanceCalculatorOverlay extends ItemizedOverlay<OverlayItem> {
	private List<OverlayItem> overlayItems = new ArrayList<OverlayItem>();
	
	public DistanceCalculatorOverlay(Drawable defaultMarker) {
		//makes center-bottom point of an image as point of consideration
		super(boundCenterBottom(defaultMarker));
	}

	@Override
	protected OverlayItem createItem(int num) {
		return overlayItems.get(num);
	}

	@Override
	public int size() {
		return overlayItems.size();
	}
	
	/**
	 * adds overlay item to the list of items in this overlay 
	 * 
	 * @param item overlay item to be added
	 */
	public void addOverlay(OverlayItem item) {
		overlayItems.add(item);
		populate();
	}
}
